<template>
    <div id="init-viewer-wrapper">
    </div>
</template>
  
<script>
export default {
    name: 'Demo',
    components: {},
    mounted() {
        this.initViewer()
    },
    methods: {
        async initViewer() {
            Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0ZTk4Y2FhYS1jZWY0LTQ5ZmYtOTdjYS03MzA2MzQ2NzlkZTIiLCJpZCI6MjU1MjM1LCJpYXQiOjE3NDgzMTI5MDB9.e_cOgNV_LVan_lLlPk1YVCfGFGlZNq3AajvlYL89E3M";
            const viewer = window.viewer = new window.Cesium.Viewer("init-viewer-wrapper", {
                // terrainProvider: new window.Cesium.CesiumTerrainProvider({
                //     url: 'http://data.mars3d.cn/terrain',
                //     requestWaterMask: true,
                //     requestVertexNormals: true
                // }),
                // imageryProvider: new window.Cesium.ArcGisMapServerImageryProvider({
                //     url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
                // }),
                sceneMode: window.Cesium.SceneMode.SCENE3D,
                vrButton: false,
                animation: false,
                baseLayerPicker: false,
                geocoder: false,
                timeline: false,
                fullscreenButton: false,
                homeButton: false,
                creditContainer: document.createElement('div'),
                infoBox: false,
                navigationHelpButton: false,
                sceneModePicker: false,
                scene3DOnly: true,
                selectionIndicator:false,
                skyBox: new window.Cesium.SkyBox({
                    sources: {
                        positiveX: require('@/assets/images/tycho2t3_80_px.jpg'),
                        negativeX: require('@/assets/images/tycho2t3_80_mx.jpg'),
                        positiveY: require('@/assets/images/tycho2t3_80_py.jpg'),
                        negativeY: require('@/assets/images/tycho2t3_80_my.jpg'),
                        positiveZ: require('@/assets/images/tycho2t3_80_pz.jpg'),
                        negativeZ: require('@/assets/images/tycho2t3_80_mz.jpg'),
                    }
                })
            });
            window.viewer.scene.globe.depthTestAgainstTerrain = true;
            window.viewer.scene.screenSpaceCameraController.enableTilt = true
            window.viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

            viewer.shadows = true
            window.viewer.scene.light = new window.Cesium.DirectionalLight({
                direction: window.Cesium.Cartesian3.fromElements(-0.2, -0.5, -0.8),
                intensity: 1
            })
            
        }
    }
}
</script>
  
<style>
#init-viewer-wrapper {
    width: 100%;
    height: 100%;
}
</style>
  